package org.xfy.sys.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.xfy.base.util.AjaxResult;
import org.xfy.sys.domain.dto.PhoneUserFormDto;
import org.xfy.sys.service.IVerifyCodeService;

import javax.validation.Valid;

@RestController
public class VerifyCodeController {
    @Autowired
    private IVerifyCodeService verifyCodeService;
    @GetMapping("/verifyCode/{key}")
    public AjaxResult verifyCode(@PathVariable("key") String key){
        return verifyCodeService.getverifyCode(key);
    }

    @PostMapping("/sendMobileCode")
    public AjaxResult sendMobileCode(@Valid @RequestBody PhoneUserFormDto phoneUserFormDto){
        return verifyCodeService.sendMobileCode(phoneUserFormDto);
    }
}
